<template>
  <div class="user">
    <header>
      <div class="header-tit">
        <div class="top">
          <img @click="$router.push('/info')" :src="infoList!=={}?infoList.avatar:''" alt="" />
          <span v-if="infoList=={}" @click="$router.push('/login')" class="del">登录/注册</span>
          <span v-if="infoList!=={}" class="del">昵称:{{ infoList.nickname }}</span>
          <span class="bj">
            <van-icon name="edit" />编辑
          </span>
        </div>
        <div class="bottom">
          <div class="a1">
            <p style="color: #f95329">0</p>
            <p style="color: #000">我的课程</p>
            <p style="color: #999">-已购课程学习-</p>
          </div>
          <div class="a1">
            <p style="color: #f95329">0</p>
            <p style="color: #000">我的预约</p>
            <p style="color: #999">-一对一老师预约-</p>
          </div>
          <div class="a1">
            <p style="color: #f95329">0</p>
            <p style="color: #000">剩余学习币</p>
            <p style="color: #999">-查看剩余学习币-</p>
          </div>
        </div>
      </div>
    </header>

    <div class="cen">
      <div class="cen-1">
        <van-icon name="envelop-o" />
      </div>
      <div class="cen-2">
        <p>邀请好友注册APP，享多重好礼</p>
        <p>限时特惠，多邀多得</p>
      </div>
      <div class="cen-3">&gt;</div>
    </div>

    <div class="tab-1">
      <h4>课程相关</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../assets/img/keben.png" alt="" />
          <p>我的作业</p>
        </div>
        <div class="tab-1-m" @click="$router.push('/concern')">
          <img src="../assets/img/wode.png" alt="" />
          <p>关注的老师</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/xingxing.png" alt="" />
          <p>我的收藏</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/xiazai.png" alt="" />
          <p>我的下载</p>
        </div>
      </div>
    </div>

    <div class="tab-1">
      <h4>订单相关</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../assets/img/wodedingdan.png" alt="" />
          <p>我的订单</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/shouhuodizhi.png" alt="" />
          <p>收获地址</p>
        </div>
      </div>
    </div>

    <div class="tab-1">
      <h4>订单账户</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../assets/img/youhuiquan.png" alt="" />
          <p>优惠券</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/yinhangka.png" alt="" />
          <p>学习卡</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/huiyuan.png" alt="" />
          <p>会员</p>
        </div>
      </div>
    </div>

    <div class="tab-1">
      <h4>自助服务</h4>
      <div class="box">
        <div class="tab-1-m">
          <img src="../assets/img/lingdang.png" alt="" />
          <p>我的消息</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/xinfeng.png" alt="" />
          <p>意见反馈</p>
        </div>
        <div class="tab-1-m">
          <img src="../assets/img/kefu.png" alt="" />
          <p>在线客服</p>
        </div>
        <div class="tab-1-m" @click="$router.push('/options')">
          <img src="../assets/img/shezhi.png" alt="" />
          <p>设置</p>
        </div>
      </div>
    </div>
    <tabbar></tabbar>
  </div>
</template>

<script>
import tabbar from "@/components/tabbar.vue"
import { getusermessage } from "@/http/request";
export default {
  data() {
    return {
      url: require("../assets/img/header-logo.png"),
      flag: true,
      infoList: {
        avatar:require("../assets/img/header-logo.png")
      },
    };
  },
  created() {
    if (localStorage.getItem("remember_token")) {
      this.name = localStorage.getItem("name");
    }
    this.getusermessageList();
    // if(this.infoList=={}){

    // }
  },
  methods: {
    async getusermessageList() {
      let res = await getusermessage();
      console.log(res);
      this.infoList = res.data.data;
    },
  },
  components: {
    tabbar
  }
};
</script>

<style lang="scss" scoped>
.user {
  font-size: 14px;
  height: 120vh;
  header {
    position: relative;
    width: 100vw;
    height: 150px;
    border-bottom-left-radius: 60px;
    border-bottom-right-radius: 60px;
    background: #fb5500;

    .header-tit {
      position: absolute;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
      width: 90%;
      height: 170px;
      border-radius: 15px;
      background: white;

      .top {
        position: relative;
        height: 50%;
        font-size: 16px;
        img {
          position: absolute;
          top: 50%;
          left: 20px;
          transform: translateY(-50%);
          width: 50px;
          height: 50px;
          border-radius: 50%;
          border: 1px solid #ccc;
        }

        .del {
          position: absolute;
          top: 40%;
          left: 100px;
          color: #000;
          transform: translateY(-50%);
        }

        .bj {
          position: absolute;
          top: 50px;
          right: 0;
          display: inline-block;
          width: 50px;
          height: 30px;
          color: white;
          font-size: 12px;
          line-height: 30px;
          text-align: center;
          background: #fd5900;
          border-top-left-radius: 30px;
          border-bottom-left-radius: 30px;
        }
      }

      .bottom {
        display: flex;
        height: 30%;
        .a1 {
          width: 33vw;
          font-size: 12px;
          text-align: center;
          border: 1px solid #ccc;
          margin: 0 5px;
        }
      }
    }
  }

  .cen {
    width: 90%;
    height: 60px;
    color: white;
    background: #fe5f01;
    margin-top: 50px;
    margin-left: 5%;
    border-radius: 50px;
    display: flex;
    font-size: 25px;
    justify-content: space-around;

    .cen-1,
    .cen-3 {
      line-height: 60px;
    }

    .cen-2 {
      p {
        margin: 10px 0;
        font-size: 12px;
      }
    }
  }

  .tab-1 {
    width: 90%;
    margin-top: 5px;
    margin-left: 5%;
    background: #eee;
    height: 80px;
    padding: 2px;
    .box {
      width: 100%;
      display: flex;
      .tab-1-m {
        width: 25%;
        height: 100%;
        position: relative;
        img {
          position: absolute;
          top: 10px;
          left: 50%;
          transform: translateX(-50%);
          width: 20px;
          height: 20px;
        }

        p {
          width: 100%;
          position: absolute;
          top: 40px;
          text-align: center;
          font-size: 12px;
        }
      }
    }
  }
}
</style>